home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 6: Level 6 / 17 Bit - Level 6 (1998)(Epic Marketing)[!].iso / quartz / q0429.dms / q0429.adf / raypaint / main.c < prev    next >
C/C++ Source or Header  |  1991-08-08  |  3KB  |  131 lines

  1. /*
  2.  * main.c
  3.  *
  4.  * Copyright (C) 1989, 1991, Craig E. Kolb
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  * $Id: main.c,v 4.0 91/07/17 17:36:46 kolb Exp Locker: kolb $
  17.  *
  18.  * $Log:    main.c,v $
  19.  * Revision 4.0  91/07/17  17:36:46  kolb
  20.  * Initial version.
  21.  * 
  22.  * 
  23.  */
  24.  
  25. char rcsid[] = "$Id: main.c,v 4.0 91/07/17 17:36:46 kolb Exp Locker: kolb $";
  26.  
  27. #include "rayshade.h"
  28. #include "options.h"
  29. #include "stats.h"
  30. #include "viewing.h"
  31. #include "picture.h"
  32.  
  33. void RSInitialize(), RSStartFrame();
  34.  
  35. int
  36. main(argc, argv)
  37. int argc;
  38. char **argv;
  39. {
  40.     Float utime, stime;
  41.  
  42.     /*
  43.       * Initialize variables, etc.
  44.      */
  45.     RSInitialize(argc, argv);
  46.     RSStartFrame(Options.startframe);
  47.     /*
  48.       * Print more information than we'll ever need to know...
  49.      */
  50.     if (Options.verbose) {
  51.         extern Geom *World;
  52.         /* World object info. */
  53.         AggregatePrintInfo(World, Stats.fstats);
  54.         /* Print info about rendering options and the like. */
  55.         RSOptionsList();
  56.     }
  57.     /*
  58.      * Print preprocessing time.
  59.      */
  60.     RSGetCpuTime(&utime, &stime);
  61.     fprintf(Stats.fstats,"Preprocessing time:\t");
  62.     fprintf(Stats.fstats,"%2.2fu  %2.2fs\n", utime, stime);
  63.     fprintf(Stats.fstats,"Starting trace.\n");
  64.     (void)fflush(Stats.fstats);
  65.     /*
  66.      * Render the image.
  67.      */
  68.     Render(argc, argv);
  69.     StatsPrint();
  70.     return 0;
  71. }
  72.  
  73. static void
  74. RSStartFrame(frame)
  75. int frame;
  76. {
  77.     /*
  78.      * Set the frame start time
  79.      */
  80.     Options.framenum = frame;
  81.     Options.framestart = Options.starttime +
  82.             Options.framenum*Options.framelength;
  83.     SamplingSetTime(Options.framestart, Options.shutterspeed,
  84.             Options.framenum);
  85.     /*
  86.      * Set up viewing parameters.
  87.      */
  88.     RSViewing();
  89.     /*
  90.      * Initialize world
  91.      */
  92.     WorldSetup();
  93. }
  94.  
  95. /*
  96.  * Initialize non-time-varying goodies.
  97.  */
  98. static void
  99. RSInitialize(argc, argv)
  100. int argc;
  101. char **argv;
  102. {
  103.     /*
  104.       * Initialize variables, etc.
  105.      */
  106.     RSSetup();
  107.     /*
  108.      * Parse options from command line.
  109.      */
  110.     RSOptionsSet(argc, argv);
  111.     /*
  112.      * Process input file.
  113.      */
  114.     if (Options.verbose) {
  115.         VersionPrint();
  116.         fprintf(Stats.fstats,"Reading input file...\n");
  117.         (void)fflush(Stats.fstats);
  118.     }
  119.     RSReadInputFile();
  120.     /*
  121.      * Set variables that weren't set on command line
  122.      * or in input file.
  123.      */
  124.     RSCleanup();
  125.     /*
  126.      * Set sampling options.
  127.      */
  128.     SamplingSetOptions(Options.samples, Options.gaussian,
  129.                Options.filterwidth);
  130. }
  131.